Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
404 error when performing "Get" request to API

Trying to perform a "get" request to API. I know the API will return the data when I do the "get" from Postman. So I believe the problem is with my HTML.

<!DOCTYPE html>
<html>
<body>
    <h1>My First Heading</h1>
    <p>My first paragraph.</p>

        <script>
            const Http = new XMLHttpRequest();
            const url='https://localhost:44369';
            Http.open("GET", url);
            Http.send();

            Http.onreadystatechange = (e) => {
            console.log(Http.responseText)
            }

        </script>
</body>
</html>

Here's the API method I'm trying to "get" from:

    //https://localhost:44369/api/Request
    [EnableCors("AllowLocalhostOrigins")]
    [HttpGet]
    public ActionResult GetText()
    {
       string a = "b";

        return Ok(a);
    }

Here's the error I'm getting: 404 Not Found

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After doing some more reading, I see that it's a problem with the API and not the html code I posted this question about. The html code I posted works fine.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda